import 'package:flutter/material.dart';

/// 展示一个空提示
class TagEmpty extends StatelessWidget {
  final String text;
  final IconData? icon;
  final double paddingTop;
  final double paddingBottom;
  final Color? color;
  final Widget? button;

  const TagEmpty(
    this.text, {
    Key? key,
    this.icon = Icons.format_list_bulleted,
    this.paddingTop = 30.0,
    this.paddingBottom = 10.0,
    this.color,
    this.button,
  }) : super(key: key);

  @override
  Widget build(BuildContext context) {
    final textColor = color ?? Theme.of(context).textTheme.caption?.color;
    return Container(
      padding: EdgeInsets.only(top: paddingTop, bottom: paddingBottom),
      child: Column(
        mainAxisSize: MainAxisSize.min,
        crossAxisAlignment: CrossAxisAlignment.center,
        children: <Widget>[
          if (icon != null)
            Padding(
              padding: const EdgeInsets.only(bottom: 10.0),
              child: Icon(
                icon,
                size: 50.0,
                color: textColor,
              ),
            ),
          Text(
            text,
            style: TextStyle(color: textColor, fontSize: 14),
          ),
          const SizedBox(height: 10),
          if (button != null) button!
        ],
      ),
    );
  }
}
